<?php
header('Content-type:text/html;charset=utf-8');
if ($_POST) {
	function checkImg($img) {
		$arr = array('jpg', 'gif', 'png', 'jpeg');
		$type = strrchr($img, '.');
		$mun = ltrim($type, '.');
		if (in_array($mun, $arr)) {
			return TRUE;
		} else {
			return FALSE;
		}

	}

	$bool = checkImg($_POST['pics']);
}
?>
<html>
	<head>
		<title></title>
		<style type="text/css">
		* {
	margin: 0;
	padding: 0;
}
div{
	width: 300px;
	height: 300px;
	border: 1px solid red;
	margin: 50px auto;
	background: url(1.jpg) no-repeat 0 0;
	background-size: 300px 300px;
}
div h2{
	color: red;
}
</style>
	</head>
	<body>
		<div>
			<form action="" method="post">
				<input type="file" name="pics" value="" />
				<input type="submit" value="提交"/>
			</form>
			<h2><?php  echo isset($bool)? ($bool==1 ? 'true' : 'false') : '' ?></h2>
		</div>
	</body>
</html>